import service from "@/utils/request";

/**
 * 获取基金基础信息
 */
export async function getFundBasic(fund = "") {
  return await service
    .request({
      method: "get",
      url: "/fund/fund_basic",
      params: {
        fund
      }
    })
    .then(response => response.data)
    .catch(error => {
      return Promise.reject(error);
    });
}
/**
 * 删除基金基础
 */
export async function deleteFundBasic(fund) {
  return await service
    .request({
      method: "delete",
      url: "/fund/fund_basic",
      data: {
        fund
      }
    })
    .then(res => res.data)
    .catch(err => {
      return Promise.reject(err);
    });
}
/**
 * 删除基金基础
 */
export async function postFundBasic(form) {
  return await service
    .request({
      method: "post",
      url: "/fund/fund_basic",
      data: {
        form
      }
    })
    .then(res => res.data)
    .catch(error => {
      return Promise.reject(error);
    });
}
/**
 * 从后端获取基金数据列表
 */
export async function getFundHold(acc_id) {
  return await service
    .request({
      method: "get",
      url: "/fund/fund_hold",
      data: {
        acc_id
      },
      params: {
        acc_id
      }
    })
    .then(res => res.data)
    .catch(error => {
      return Promise.reject(error);
    });
}
/**
 * 从后端获取基金报表
 */
export async function getReport() {
  return await service
    .request({
      method: "get",
      url: "/fund/report"
    })
    .then(res => res.data)
    .catch(error => {
      return Promise.reject(error);
    });
}
